﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="getpassword.aspx.cs" Inherits="EmProductCenter.user.getpassword" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>修改密码</title>
    <script src="../js/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="../js/login.js" type="text/javascript"></script>
    <script src="../js/main.js" type="text/javascript"></script>
    <link rel="stylesheet" href="../css/pxjd.css" type="text/css" />
</head>
<body>
    <!-- 登录 密码输入不一致！ --->
    <div class="login_panel login contentDiv">
        <div class="panel_title">
            <a href="../pxjd/wlpxyy.aspx" class="panel_close">close</a></div>
        <div class="panel_content">
            <table width="350" border="0" cellspacing="8" cellpadding="0">
                <tr>
                    <td width="110" class="txt_right">
                    </td>
                    <td width="208">
                        <span class="blue" id="newPWMsg">新密码为6-16个字符</span>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td width="110" class="txt_right">
                        新密码：
                    </td>
                    <td width="208">
                        <input type="password" id="newPW" maxlength="50" />
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td width="110" class="txt_right">
                        确认新密码：
                    </td>
                    <td width="208">
                        <input type="password" id="newPWD" maxlength="50" />
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td width="110" class="txt_right">
                        &nbsp;
                    </td>
                    <td width="208">
                        <div class="control submit">
                            <a href="javascript:void(0);" onclick="return SavePW();">保存密码</a></div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <!-- 登录 密码输入不一致！ end --->
    <div id="fullscreem" style="background-color: #F1F1F1; filter: alpha(opacity=50);
        opacity: 0.5; width: 100%; height: auto; position: absolute; top: 0px; left: 0px;
        z-index: 5;">
    </div>
    <input type="hidden" id="hid_userName" />
    <script type="text/javascript">
        //保存
        function SavePW() {
            var loginName = $.trim($("#hid_userName").val());
            var newPassWord = $.trim($("#newPW").val());
            var newPassWordD = $.trim($("#newPWD").val());
            if (newPassWord == "") {
                $("#newPWMsg").text("密码不能为空！");
                $("#newPWMsg").removeClass().addClass("red");
                return false;
            }
            if (newPassWordD == "") {
                $("#newPWMsg").text("确认密码不能为空！");
                $("#newPWMsg").removeClass().addClass("red");
                return false;
            }
            if (newPassWord != newPassWordD) {
                $("#newPWMsg").text("密码输入不一致！");
                $("#newPWMsg").removeClass().addClass("red");
                return false;
            }
            $.ajax({
                type: "POST",
                url: "../pxjd/CourseInfo.ashx",
                dataType: "json",
                data: { action: "UpdatePW", loginName: loginName, passWord: newPassWord },
                success: function (result) {
                    if (result == "0") {
                        alert("修改密码成功！");
                        window.location.href = "../pxjd/wlpxyy.aspx";
                    }
                    else if (result == "1") {
                        $("#newPWMsg").text("用户不存在，请检查连接是否正确！");
                        return false;
                    }
                    else {
                        alert("修改密码失败！");
                        return false;
                    }
                }
            });
        }
        $(document).ready(function () {
            var Request = new QueryString();
            var uid = Request["uid"];
            uid = $.trim(uid);
            if (uid == "undefined" || uid == "") {
                window.location.href = "../pxjd/wlpxyy.aspx";
            }
            $("#hid_userName").val(uid);
            CloseContentDiv(1);
        });
    </script>
</body>
</html>
